AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )

include('shared.lua')

function ENT:SpawnFunction( ply, tr )

	if ( !tr.Hit ) then return end
	
	local SpawnPos = tr.HitPos + tr.HitNormal * 16
	local ent = ents.Create( "MatGrabber" )
	ent:SetPos( SpawnPos )
	ent:Spawn()
	ent:DropToFloor()
	ent:Activate()
	ent.SPL = ply
	return ent
end

function ENT:Initialize()
	self.Entity:SetModel( "models/hunter/plates/plate1x1.mdl" )
	self.Entity:PhysicsInit( SOLID_NONE )
	self.Entity:SetMoveType( MOVETYPE_NONE )
	self.Entity:SetSolid( SOLID_NONE )
	self.Entity:DrawShadow( false )
	self:Grassonly()
	local phys = self.Entity:GetPhysicsObject()
	if (phys:IsValid()) then
		phys:Wake()
		phys:EnableMotion(false)
		phys:EnableCollisions(true)
	end
end

function ENT:Grassonly()
	local trace = {}
	trace.start = self:GetPos()
	trace.endpos = self:GetPos()-Vector(0,0,100)
	trace.filter = self
	local Land = util.TraceLine( trace )
	PrintTable(Land)
	return 
end



function ENT:OnRemove()
end

function ENT:Think()

	self.Entity:NextThink( CurTime() + 1 )
	return true
end